package org.toolbook.util;

import java.io.IOException;
import java.util.Properties;

/**
 * 获取appconfig.properties文件中配置
 * @author meigang
 * @date	2015-06-18 22:21
 *
 */
public class PropUtil{

	public static Properties props = new Properties();

	/**
	 * 配置文件地址
	 */
	private static final String FILE_PATH_KEY = "appconfig.properties";
	
	static{
		try {
			props.load(PropUtil.class.getClassLoader().getResourceAsStream(FILE_PATH_KEY));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			throw new RuntimeException("加载classpath下的appconfig.properties文件出错。" + e.getMessage());
		}
	}
	
	public static String getProperty(String key){
		return props.getProperty(key);
	}
	
	public static void main(String[] args) {
		System.out.println(props.getProperty("user"));
	}
}
